<template>
  <div class="new-book-plaza">
    <titleBar title="朱佳榕新书广场 " :learnMore="{title: '进店逛逛'}"></titleBar>
    <div class="new-book-content">
      <div class="new-book-item" v-for="item in data" :key="item.id">
        <router-link class="buy-btn" :to="{path: `/book/${item.id}`}">
          <img :src="item.img">
        </router-link>
        <div class="text-content">
          <div class="title">{{ item.title }}</div>
          <div class="desc">{{ item.desc }}</div>
          <div class="tags">
            <div class="tag-item" v-for="(item, index) in item.tags" :key="index">
              {{ item }}
              <div class="jiao">
                <div class="jiao-inner"></div>
              </div>
            </div>
          </div>
          <div class="buy-box">
            <div class="price">
              ￥{{ item.price }}
              <span class="free-mail" v-if="item.freeMail">包邮</span>
            </div>
            <router-link class="buy-btn" :to="{path: `/book/${item.id}`}">立即抢购</router-link>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import titleBar from '@/bookComponents/title/index'
export default {
  name: 'newBookPlaza',
  components: {
    titleBar
  },
  props: {
    data: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style lang="scss" scope>
  .new-book-plaza {
    .new-book-content {
      margin: 15px 0;
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      grid-column-gap: 20px;
      .new-book-item {
        width: 100%;
        background: #FFFFFF;
        border: 1px solid #AFAFAF;
        .text-content {
          padding: 10px;
        }
        img {
          width: 100%;
          margin-bottom: 10px;
        }
        .title {
          overflow: hidden;
          height: 20px;
          line-height: 20px;
          font-size: 14px;
          padding: 0 10px;
          margin-bottom: 10px;
        }
        .desc {
          font-size: 12px;
          line-height: 16px;
          padding: 0 1em;
          height: 32px;
          overflow: hidden;
          margin-bottom: 15px;
        }
        .tags {
          display: flex;
          flex-direction: row;
          padding: 0 10px;
          padding-bottom: 10px;
          border-bottom: 1px dashed #AFAFAF;
          .tag-item + .tag-item {
            margin-left: 10px;
          }
          .tag-item {
            position: relative;
            display: block;
            border: 1px solid #dfc49b;
            color: #C28F42;
            padding: 5px 7px;
            font-size: 12px;
            .jiao {
              width: 0;
              height: 0;
              border-bottom: 6px solid #dfc49b;
              border-left: 6px solid transparent;
              position: absolute;
              right: -1px;
              bottom: -1px;
              .jian-inner {
                width: 0;
                height: 0;
                border-bottom: 5px solid #fdfbfc;
                border-left: 5px solid transparent;
                position: absolute;
                right: 0;
                bottom: -6px;
              }
            }
          }
        }
        .buy-box {
          display: flex;
          flex-direction: row;
          margin: 15px 0 0 0;
          align-items: center;
          .price {
            flex: 1;
            color: #8C222C;
            font-size: 18px;
            font-weight: 400;
            .free-mail {
              font-size: 12px;
            }
          }
          .buy-btn {
            display: block;
            padding: 10px 25px;
            color: #FFFFFF;
            background: #8C222C;
            text-decoration: none;
            font-size: 14px;
            &:hover{
              background-color:mix(black,#8C222C,15%)
            }
          }
        }
      }
    }
  }
</style>
